package com.onefish.toolkit;

import org.springframework.core.io.ClassPathResource;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class FileOperation {
    public static void readJarFile(){
        //  try catch 快捷键 ctrl+alt+t
        BufferedReader reader;
        try {
            InputStream inputStream = new ClassPathResource("/docs/notes.txt").getInputStream();
            reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
            String line;
            // 逐行读取文件内容
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
